/**
 * com.cnhis.his.customer.service.Vam1Service.java
 */
package com.mbmed.doctor.homepage.service;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mbmed.doctor.homepage.bo.Rab1Bo;
import com.mbmed.doctor.homepage.bo.Vaj2Bo;
import com.mbmed.doctor.homepage.bo.Vam1Bo;
import com.mbmed.doctor.homepage.mapper.Rab1;
import com.mbmed.doctor.homepage.mapper.Vaj2;
import com.mbmed.doctor.homepage.mapper.Vam1;

/**
 * @file  Vam1Service.java
 * @author 刘武
 * @version 0.1
 * @todo	Vam1服务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2014-10-14 10:26:28
 *      	Author: 刘武
 *      	Modification: this file was created
 *   	2. ...
 */
@Path("/vam1")
@Component
public class Vam1Service {
	
	private static Logger logger = Logger.getLogger(Vam1.class);
	
	@Autowired
	private Vam1Bo vam1Bo;
	
	@Autowired
	private Rab1Bo rab1Bo;
	
	@Autowired
	private Vaj2Bo vaj2Bo;
	
	@Context
	Request request;

	
	/**
	 * 查找所有数据库记录
     * @return type : List 返回查询操作所有符合条件的记录的VO对象集合，操作失败返回null
     */
	@GET
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Vam1> getAll() throws Exception{
        List<Vam1> list = new ArrayList<Vam1>();
        return vam1Bo.getAll();        
    }
	
	
	
	/**
     * 查询病案手术详情
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("/getmedrecvam1byvae01")
	@Produces({MediaType.APPLICATION_JSON})
    public Vam1 getMedrecVam1ByVae01(@QueryParam("vae01") java.lang.String vae01) throws Exception{
		Vam1 vam1 = null;
		vam1 = vam1Bo.getMedrecVam1ByVae01(vae01);
		
		if(null == vam1){
			return null;
		}
		
		List<Rab1> rab1List = new ArrayList<Rab1>();
		rab1List = rab1Bo.getRab1ByVae01(vae01);
		if(!(null==rab1List)){
			vam1.setRab1List(rab1List);
		}
		
		List<Vaj2> vaj2List = new ArrayList<Vaj2>();
		vaj2List = vaj2Bo.getVaj2ByVae01(vae01);
		if(!(null==vaj2List)){
			vam1.setVaj2List(vaj2List);
		}
		
    	return vam1;
	}

	
    /**
     * 查找符合条件的所有数据库记录
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Vam1 getVam1(@PathParam("id") String id) throws Exception{
    	Vam1 vam1 = null;
    	return vam1Bo.get(id);        
    }
    /**
     * 向数据库中插入一条记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : 返回插入操作是否成功
     * @throws Exception
     */
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	public Vam1 saveVam1(
			@FormParam("vaa07") java.lang.Integer vaa07,
			@FormParam("vam02") java.lang.String vam02,
			@FormParam("vam03") java.lang.String vam03,
			@FormParam("vam04") java.lang.Byte vam04,
			@FormParam("vam05") java.lang.String vam05,
			@FormParam("vam06") java.lang.Byte vam06,
			@FormParam("vam07") java.lang.String vam07,
			@FormParam("vam08") java.lang.Byte vam08,
			@FormParam("vam09") java.lang.Byte vam09,
			@FormParam("vam10") java.lang.Byte vam10,
			@FormParam("vam11") java.lang.Byte vam11,
			@FormParam("vam12") java.lang.Byte vam12,
			@FormParam("vam13") java.lang.Byte vam13,
			@FormParam("vam14") java.lang.String vam14,
			@FormParam("vam15") java.lang.String vam15,
			@FormParam("vam16") java.lang.String vam16,
			@FormParam("vam17") java.lang.String vam17,
			@FormParam("vam18") java.lang.Byte vam18,
			@FormParam("vam19") java.lang.Byte vam19,
			@FormParam("vam20") java.lang.Byte vam20,
			@FormParam("vam21") java.lang.Byte vam21,
			@FormParam("vam22") java.lang.Byte vam22,
			@FormParam("vam23") java.lang.Byte vam23,
			@FormParam("vam24") java.lang.Byte vam24,
			@FormParam("vam25") java.lang.Byte vam25,
			@FormParam("vam26") java.lang.String vam26,
			@FormParam("vam27") java.lang.String vam27,
			@FormParam("vam28") java.lang.String vam28,
			@FormParam("vam29") java.lang.String vam29,
			@FormParam("vam30") java.lang.String vam30,
			@FormParam("vam31") java.lang.String vam31,
			@FormParam("vam32") java.lang.String vam32,
			@FormParam("vam33") java.lang.String vam33,
			@FormParam("vam34") java.lang.String vam34,
			@FormParam("vam35") java.lang.String vam35,
			@FormParam("vam36") java.util.Date vam36,
			@FormParam("vam37") java.lang.Byte vam37,
			@FormParam("vam38") java.lang.String vam38,
			@FormParam("vam39") java.util.Date vam39,
			@FormParam("vam40") java.lang.Byte vam40,
			@FormParam("vam41") java.lang.Byte vam41,
			@FormParam("vam42") java.lang.Byte vam42,
			@FormParam("vam43") java.lang.Byte vam43,
			@FormParam("vam44") java.lang.Byte vam44,
			@FormParam("vam45") java.lang.Byte vam45,
			@FormParam("vam46") java.lang.Byte vam46,
			@FormParam("vam47") java.lang.Byte vam47,
			@FormParam("vam48") java.lang.Byte vam48,
			@FormParam("vam49") java.lang.Byte vam49,
			@FormParam("vam50") java.math.BigDecimal vam50,
			@FormParam("vam51") java.math.BigDecimal vam51,
			@FormParam("vam52") java.math.BigDecimal vam52,
			@FormParam("vam53") java.math.BigDecimal vam53,
			@FormParam("vam54") java.lang.String vam54,
			@FormParam("vam55") java.lang.Byte vam55,
			@FormParam("vam56") java.lang.Integer vam56,
			@FormParam("vam57") java.lang.Integer vam57,
			@FormParam("vam58") java.lang.Integer vam58,
			@FormParam("vam59") java.lang.Integer vam59,
			@FormParam("vam60") java.lang.Integer vam60,
			@FormParam("vam61") java.lang.Integer vam61,
			@FormParam("vam62") java.lang.Integer vam62,
			@FormParam("vam63") java.lang.Byte vam63,
			@FormParam("vam64") java.lang.Byte vam64,
			@FormParam("vam65") java.lang.Byte vam65,
			@FormParam("vam66") java.lang.Byte vam66,
			@FormParam("vam67") java.math.BigDecimal vam67,
			@FormParam("vam68") java.lang.String vam68,
			@FormParam("vam69") java.util.Date vam69,
			@FormParam("vam70") java.lang.String vam70,
			@FormParam("vam71") java.util.Date vam71,
			@FormParam("vam72") java.lang.Byte vam72,
			@FormParam("vam73") java.lang.Byte vam73,
			@FormParam("vam74") java.lang.String vam74,
			@FormParam("vam75") java.lang.Integer vam75,
			@FormParam("vam76") java.lang.Byte vam76,
			@FormParam("vam77") java.lang.Byte vam77,
			@FormParam("vam78") java.lang.Byte vam78,
			@FormParam("vam79") java.lang.Byte vam79,
			@FormParam("vam80") java.lang.String vam80,
			@FormParam("vam81") java.lang.String vam81,
			@FormParam("vam82") java.lang.String vam82,
			@FormParam("bce03") java.lang.String bce03,
			@FormParam("vam84") java.lang.String vam84,
			@FormParam("vam85") java.lang.String vam85,
			@FormParam("vam86") java.lang.String vam86,
			@FormParam("vam87") java.lang.Integer vam87,
			@FormParam("vam88") java.lang.String vam88,
			@FormParam("vam89") java.lang.String vam89,
			@FormParam("vam90") java.lang.String vam90,
			@FormParam("vam91") java.lang.Byte vam91,
			@FormParam("bce01b") java.lang.Integer bce01b,
			@FormParam("bce03b") java.lang.String bce03b,
			@FormParam("vam94") java.util.Date vam94,
			@FormParam("vam95") java.lang.String vam95,
			@FormParam("vam96") java.lang.Byte vam96,
			@FormParam("vam97") java.lang.Byte vam97,
			@FormParam("vam98") java.lang.Byte vam98,
			@FormParam("vam99") java.lang.Byte vam99,
			@FormParam("vama1") java.lang.Byte vama1,
			@FormParam("vama2") java.math.BigDecimal vama2,
			@FormParam("bce03c") java.lang.String bce03c,
			@Context HttpServletResponse servletResponse
	) throws Exception {
		Vam1 vam1 = new Vam1();
		vam1.setVaa07(vaa07);
		vam1.setVam02(vam02);
		vam1.setVam03(vam03);
		vam1.setVam04(vam04);
		vam1.setVam05(vam05);
		vam1.setVam06(vam06);
		vam1.setVam07(vam07);
		vam1.setVam08(vam08);
		vam1.setVam09(vam09);
		vam1.setVam10(vam10);
		vam1.setVam11(vam11);
		vam1.setVam12(vam12);
		vam1.setVam13(vam13);
		vam1.setVam14(vam14);
		vam1.setVam15(vam15);
		vam1.setVam16(vam16);
		vam1.setVam17(vam17);
		vam1.setVam18(vam18);
		vam1.setVam19(vam19);
		vam1.setVam20(vam20);
		vam1.setVam21(vam21);
		vam1.setVam22(vam22);
		vam1.setVam23(vam23);
		vam1.setVam24(vam24);
		vam1.setVam25(vam25);
		vam1.setVam26(vam26);
		vam1.setVam27(vam27);
		vam1.setVam28(vam28);
		vam1.setVam29(vam29);
		vam1.setVam30(vam30);
		vam1.setVam31(vam31);
		vam1.setVam32(vam32);
		vam1.setVam33(vam33);
		vam1.setVam34(vam34);
		vam1.setVam35(vam35);
		vam1.setVam36(vam36);
		vam1.setVam37(vam37);
		vam1.setVam38(vam38);
		vam1.setVam39(vam39);
		vam1.setVam40(vam40);
		vam1.setVam41(vam41);
		vam1.setVam42(vam42);
		vam1.setVam43(vam43);
		vam1.setVam44(vam44);
		vam1.setVam45(vam45);
		vam1.setVam46(vam46);
		vam1.setVam47(vam47);
		vam1.setVam48(vam48);
		vam1.setVam49(vam49);
		vam1.setVam50(vam50);
		vam1.setVam51(vam51);
		vam1.setVam52(vam52);
		vam1.setVam53(vam53);
		vam1.setVam54(vam54);
		vam1.setVam55(vam55);
		vam1.setVam56(vam56);
		vam1.setVam57(vam57);
		vam1.setVam58(vam58);
		vam1.setVam59(vam59);
		vam1.setVam60(vam60);
		vam1.setVam61(vam61);
		vam1.setVam62(vam62);
		vam1.setVam63(vam63);
		vam1.setVam64(vam64);
		vam1.setVam65(vam65);
		vam1.setVam66(vam66);
		vam1.setVam67(vam67);
		vam1.setVam68(vam68);
		vam1.setVam69(vam69);
		vam1.setVam70(vam70);
		vam1.setVam71(vam71);
		vam1.setVam72(vam72);
		vam1.setVam73(vam73);
		vam1.setVam74(vam74);
		vam1.setVam75(vam75);
		vam1.setVam76(vam76);
		vam1.setVam77(vam77);
		vam1.setVam78(vam78);
		vam1.setVam79(vam79);
		vam1.setVam80(vam80);
		vam1.setVam81(vam81);
		vam1.setVam82(vam82);
		vam1.setBce03(bce03);
		vam1.setVam84(vam84);
		vam1.setVam85(vam85);
		vam1.setVam86(vam86);
		vam1.setVam87(vam87);
		vam1.setVam88(vam88);
		vam1.setVam89(vam89);
		vam1.setVam90(vam90);
		vam1.setVam91(vam91);
		vam1.setBce01b(bce01b);
		vam1.setBce03b(bce03b);
		vam1.setVam94(vam94);
		vam1.setVam95(vam95);
		vam1.setVam96(vam96);
		vam1.setVam97(vam97);
		vam1.setVam98(vam98);
		vam1.setVam99(vam99);
		vam1.setVama1(vama1);
		vam1.setVama2(vama2);
		vam1.setBce03c(bce03c);

		return vam1 = vam1Bo.save(vam1);

	}
	/**
     * 删除数据库中与传入的值对象对应的记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : boolean 返回删除操作是否成功
     * @throws Exception
     */
	@DELETE
	@Path("{id}")
	public boolean removeVam1(@PathParam("id") String id) throws Exception{
		if(id == null) return false;
    	return vam1Bo.remove(id);

	}
	
}
